package com.example.user.common;

import lombok.Data;

import java.io.Serializable;

/**
 * 通用返回类
 * @param <T>
 */

@Data
public class BaseResponse<T> implements Serializable {
    private Integer code;
    private T data;
    private String message;
    private String desctiption;

    public BaseResponse(int code, T data, String message ,  String desctiption) {
        this.data = data;
        this.code = code;
        this.message = message;
        this.desctiption = desctiption;
    }

    public BaseResponse(int code , T data , String message) {
        this(code, data, message , "");
    }

    public BaseResponse(int code , T data) {
        this(code, data, "" , "");
    }

    public BaseResponse(ErrorCode erroCode) {
        this(erroCode.getCode() , null , erroCode.getMessage() , erroCode.getDesctiption());
    }


}
